[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+---------+################################################################
#+-| A_BOF() |-------------------------------------------------+##############
#| +---------+ Verify if last skip operation accessed record 0 |##############
#+-------------------------------------------------------------+##############
##############################################################################
##############################################################################
#+--| Summary |------------------+############################################
#| #INCLUDE database.hdr |############################################
#+-------------------------------+############################################
##############################################################################
##############################################################################
#+--| Syntax |------------------------------+#################################
#| FUNCTION LOGICAL a_bof PROTOTYPE |#################################
#| PARAMETERS ALIAS aliasname |#################################
#+------------------------------------------+#################################
##############################################################################
##############################################################################
#####+---| Description |------------------------------------------------+#####
#####| The a_bof() function verifies whether the last skip operation |#####
#####| for the specified aliasname caused the record pointer to try to |#####
#####| access record 0, the beginning of the file. The a_bof() flag is |#####
#####| cleared on the next skip operation, unless it also encounters |#####
#####| a_bof(). The a_bof() flag is also cleared when the record |#####
#####| pointer is adjusted by any database command, |#####
#####| e.g., GOTO, SEEK etc. |#####
#####| ---------------------------------------------------------------- |#####
#####| The a_bof() function performs identically to the bof() function. |#####
#####| a_bof() differs syntactically in that it accepts an alias as a |#####
#####| parameter. |#####
#####+------------------------------------------------------------------+#####
##############################################################################
##############################################################################
#######+--| Design |--------------------------------------------------+#######
#######| Use a_bof() when your application has more than one database |#######
#######| open at one time. The a_bof() function eliminates the need |#######
#######| to manage the current workarea. |#######
#######+--------------------------------------------------------------+#######
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Print the prices of an item, starting at the |#########
#########| * most expensive. (Database is indexed on price.) |#########
#########| |#########
#########| GOTO BOTTOM |#########
#########| DO WHILE .NOT. a_bof ( parts ) |#########
#########| ? parts->pnum, parts->desc, parts->price |#########
#########| SKIP -1 |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Skip backwards to find the "parent" of a "child" |#########
#########| * record. (i.e., the data is organized in a "tree", |#########
#########| * much like a directory. |#########
#########| |#########
#########| current_level = t->level |#########
#########| DO WHILE t->level >= current_level |#########
#########| SKIP -1 |#########
#########| IF a_eof( t ) |#########
#########| ? "Error: Parent not found." |#########
#########| EXIT |#########
#########| ENDIF |#########
#########| ENDDO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * An alias can be a parameter to a PROCEDURE or |#########
#########| * FUNCTION. Here is a generic "skip Back" routine |#########
#########| |#########
#########| PROCEDURE skip_back |#########
#########| PARAMETERS ALIAS cur_alias |#########
#########| |#########
#########| !cur_alias GOTO BOTTOM |#########
#########| DO WHILE .NOT. a_bof( cur_alias ) |#########
#########| {...} |#########
#########| !cur_alias SKIP |#########
#########| ENDDO |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
a_eof()
eof()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson